package puly.arr;

public class PolyTest {
    public static void main(String[] args) {
        Employee employee=new Worker("tom",2500);
        System.out.println(employee.getAnnual());
        Worker worker=(Worker) employee;
        worker.work();

        Employee employee1=new Manager("milan",5000,15000);
        System.out.println(employee1.getAnnual());

        Worker tom=new Worker("tom",2500);
        Manager milan= new Manager("milan",5000,200000);
        PolyTest polyTest=new PolyTest();
        polyTest.showEmpAnuual(tom);
        polyTest.showEmpAnuual(milan);
        polyTest.testWork(tom);
        polyTest.testWork(milan);
    }
    public void showEmpAnuual(Employee e){
        System.out.println(e.getAnnual());
    }
    public void testWork(Employee e){
        if(e instanceof Worker){
            ((Worker) e).work();
        } else if (e instanceof Manager) {
            ((Manager) e).manage();

        }else{

        }
    }
}
